Xbasic

FILE.TEMP_CREATE Function

Syntax

Filename as C = FILE.Temp_Create(C path)

Arguments

pathCharacter

The full path specification of the file.

Returns

FilenameCharacter

Returns the fully qualified temporary file name.

Description

Create a temp filename.

Discussion

The FILE.TEMP_CREATE() method creates a temporary data file with a unique name. The temporary file is created in the directory specified by the Path parameter, or in the default directory if the supplied path is an empty string (""). The complete path and filename of this temporary file are returned. To create a file in the root directory, specify the drive name only (e.g., "d:")

Example

filename = FILE.temp_create("c:\a5")
file_pointer = FILE.open(filename, FILE_RW_EXCLUSIVE)
file_pointer.file_write("Defaults:")
file_pointer.file_flush()
file_pointer.file_close()
trace.writeln("Temporary filename: " + filename)

Before the script or application ends the temporary file should be removed.

FILE.remove(filename)

See Also